﻿using CNKI.TPI.Web.Base;
using CNKI.TPI.Web.Search.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CNKI.TPI.Web.Search.IBLL
{
    /// <summary>
    /// 文件路径访问URL生成Service
    /// </summary>
    public interface IFileService
    {
        /// <summary>
        /// 获取数字对象
        /// </summary>
        /// <param name="dbId">数据库Id</param>
        /// <param name="fileId">数字对象Id</param>
        /// <returns>访问该对象url</returns>
        string GetDigitalFile(int dbId, int fileId);
  
        /// <summary>
        /// 根据类型获取第一个数学对象
        /// </summary>
        /// <param name="dbId">数据库Id</param>
        /// <param name="recordId">记录ID</param>
        /// <param name="type">记录类型</param>
        /// <returns>访问该对象url</returns>
        string GetFirstDigitalFileByType(int dbId,int recordId,MediaType type);

        /// <summary>
        /// 获得小图片采样
        /// </summary>
        /// <param name="dbId">数据库Id</param>
        /// <param name="fileId">数字对象Id</param>
        /// <returns>访问该对象url</returns>
        string GetSmallPic(int dbId, int fileId);

        /// <summary>
        /// 获取小图像采样
        /// </summary>
        /// <param name="dbId">数据库Id</param>
        /// <param name="fileId">数字对象Id</param>
        /// <param name="filename">数字对象名称</param>
        /// <returns>访问该对象url</returns>
        string GetSmallPic(int dbId, int fileId, string filename);

        /// <summary>
        /// 获得第一个小图片采样
        /// </summary>
        /// <param name="dbId">数据库Id</param>
        /// <param name="recoredId">记录ID</param>
        /// <returns>访问该对象url</returns>
        string GetFirstSmallPic(int dbId, int recoredId);

        /// <summary>
        /// 判断文件是否存在，是否支持   0 不存在；1存在；2不支持
        /// </summary>
        /// <param name="type">文件类型</param>
        /// <param name="filePath">文件路径</param>
        /// <returns>0 不存在；1存在；2不支持 </returns>
        string ParseFile(MediaType type, string filePath);

        /// <summary>
        /// 判断是否超过最大下载数
        /// </summary>
        /// <param name="dbID">数据库ID</param>
        /// <returns>0 未超过 1 超过每日下载数 2 超过总下载数</returns>
        int GetFileDownloadLimiteInfo(int dbID);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sFileName"></param>
        /// <returns></returns>
        string GetDirByName(string sFileName);

          /// <summary>
        /// 当只有一个文件时，根据recordid找到文件路径
        /// </summary>
        /// <param name="dbId"></param>
        /// <param name="recordId"></param>
        /// <returns></returns>
        string GetFirstDigitalFile(int dbId, int recordId);
           /// <summary>
        /// 根据文件ID找到文件路径
        /// </summary>
        /// <param name="dbId"></param>
        /// <param name="fileid"></param>
        /// <returns></returns>
        string FileIsExitByFileID(int dbId, int fileid);

        /// <summary>
        /// 获取文件
        /// </summary>
        /// <param name="recordID"></param>
        /// <param name="dbName"></param>
        /// <returns></returns>
        IList<METADATA_FILE> GetFile(int recordID, string dbName);
    }
}
